home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tech Arsenal 1
/
Tech Arsenal (Arsenal Computer).ISO
/
tek-02
/
hash.zip
/
LIST.2
< prev
next >
Wrap
Text File
|
1993-01-04
|
907b
|
25 lines
Function h( KEY: string4 ): integer;
Type
KEY_types = (char_KEY, integer_KEY);
KEY_overlay = record
case KEY_types of
char_KEY: ( KEY_in_characters: string4 );
integer_KEY: ( dummy: byte; {takes up room for string size}
integer_KEY_1: integer; {first 2 bytes of KEY}
integer_KEY_2: integer; {last 2 bytes of KEY}
);
end;
Var
KEY_record: KEY_overlay;
begin {hash}
with KEY_record do
begin
KEY_in_characters := ' '; {clean out in case KEY < 4 chars}
KEY_in_characters := KEY;
h := ( integer_KEY_1 xor integer_KEY_2 ) mod number_TAB_entries;
end;
end; {hash}